#include "Department.h"
#include "Employee.h"
#include <iostream>

Department::Department(const std::string& name) : name_(name) {}

const std::string& Department::getName() const {
    return name_;
}

void Department::addEmployee(Employee* emp) {
    employees_.push_back(emp);
    emp->department_ = this; // 直接修改Employee的私有成员[7,8](@ref)
}

void Department::listEmployees() const {
    std::cout << "Employees in " << name_ << ":\n";
    for (const auto& emp : employees_) {
        std::cout << "- " << emp->name_ << "\n"; // 直接访问Employee的私有成员[7,8](@ref)
    }
}